var http = require('http')
var server = http.createServer((request, response) => {
  var reqUrl = request.url
  if (reqUrl !== '/favicon.ico') {
    var url = new URL(reqUrl, 'http://localhost:8080/')
    var obj = {}
    for (let [k, v] of url.searchParams) {
      obj[k] = v
    }
    response.writeHead(200, {
      'Content-Type': 'application/json;charset=UTF-8'
    })
    response.write(JSON.stringify(obj))
    response.end()
  }


}).listen(8080, () => {
  console.log('服务器已启动，监听端口号为8080');
})